import { request } from "../../request/index.js";
Page({
    data: {
        swiperList: [],
        catesList: [],
        floorList: []
    },
    onLoad() { //页面加载时触发
        this.getSwiperList();
        this.getCatesList();
        this.getFloorList();
    },
    //获取轮播图数据事件监听
    getSwiperList() {
        request({
            url: "/home/swiperdata", //请求的url
            // data:{},//请求的参数
            // header:{"content-type":"application/json"},//设置请求的header
            method: "get", //请求方式
            // dataType:"json",//返回的数据格式
            // responseType:"text",//响应的数据类型
        }).then((result) => {
            this.setData({
                swiperList: result.data.message
            });
        });
    },
    //获取分类导航数据事件监听
    getCatesList() {
        request({
            url: "/home/catitems",
            method: "get"
        }).then((result) => {
            this.setData({
                catesList: result.data.message
            });
        });
    },
    //获取楼层数据事件监听
    getFloorList() {
        request({
            url: "/home/floordata",
            method: "get"
        }).then((result) => {
            this.setData({
                floorList: result.data.message
            });
        });
    }
})